home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / convrtrs / hgrpcx / ega.h < prev    next >
C/C++ Source or Header  |  1991-04-12  |  3KB  |  116 lines

  1. /*
  2.  * ega.h -- (EGA) image manipulation routines
  3.  *          Header file
  4.  */
  5.  
  6. #ifndef __EGA_H
  7. #define __EGA_H
  8.  
  9. /* INCLUDES */
  10.  
  11. #include <dos.h>
  12.  
  13.  
  14.  
  15.  
  16. /* TYPEDEFS */
  17.  
  18. typedef char          BYTE;
  19. typedef unsigned char UBYTE;
  20. typedef int           WORD;
  21. typedef unsigned int  UWORD;
  22. typedef long          LONG;
  23. typedef unsigned long ULONG;
  24.  
  25. typedef int           boolean;
  26. typedef unsigned char bool;
  27.  
  28.  
  29.  
  30.  
  31. /* GLOBALS */
  32.  
  33. extern volatile UBYTE __modereg, __setres,  __esetres,
  34.               __readmap, __bitmask, __mapmask;
  35.  
  36.  
  37.  
  38.  
  39. /* DEFINES */
  40.  
  41. #define _BLACK     0
  42. #define _BLUE      1
  43. #define _GREEN     2
  44. #define _CYAN      3
  45. #define _RED       4
  46. #define _MAGENTA   5
  47. #define _BROWN     6
  48. #define _LGRAY     7
  49. #define _DGRAY     8
  50. #define _LBLUE     9
  51. #define _LGREEN   10
  52. #define _LCYAN    11
  53. #define _LRED     12
  54. #define _LMAGENTA 13
  55. #define _YELLOW   14
  56. #define _WHITE    15
  57.  
  58. #define modereg(mode)                   \
  59.      {                              \
  60.      outp(0x3CE,    5);             \
  61.      outp(0x3CF, mode);             \
  62.      __modereg = (UBYTE)(mode);     \
  63.      }
  64.  
  65. #define setres(value)                   \
  66.      {                              \
  67.      outp(0x3CE,     0);            \
  68.      outp(0x3CF, value);            \
  69.      __setres = (UBYTE)(value);     \
  70.      }
  71.  
  72. #define esetres(mask)                   \
  73.      {                              \
  74.      outp(0x3CE,    1);             \
  75.      outp(0x3CF, mask);             \
  76.      __esetres = (UBYTE)(mask);     \
  77.      }
  78.  
  79. #define readmap(mapcode)                \
  80.      {                              \
  81.      outp(0x3CE,       4);          \
  82.      outp(0x3CF, mapcode);          \
  83.      __readmap = (UBYTE)(mapcode);  \
  84.      }
  85.  
  86. #define bitmask(value)                  \
  87.      {                              \
  88.      outp(0x3CE,     8);            \
  89.      outp(0x3CF, value);            \
  90.      __bitmask = (UBYTE)(value);    \
  91.      }
  92.  
  93. #define mapmask(plane)                  \
  94.          {                              \
  95.          outp(0x3C4,     2);            \
  96.      outp(0x3C5, plane);            \
  97.      __mapmask = (UBYTE)(plane);    \
  98.      }
  99.  
  100.  
  101.  
  102.  
  103. /* PROTOTYPES */
  104.  
  105. void  clrgwin(UWORD addr, UBYTE color, UWORD nbyte, UWORD nrow);
  106. void  cls(UWORD page);
  107. int   fload_pcx(int page, const char *file_name);
  108. void  init_egfx(UBYTE mode);
  109. void  mode(WORD vmode);
  110. void  put_pixel(int x, int y, UBYTE color);
  111. UBYTE rd_byte(ULONG addr, WORD clr_plane);
  112. void  save_pcx(const char *fname, UBYTE far *pal);
  113. void  wrt_byte(UBYTE page, ULONG addr, WORD clr_plane, UBYTE byte);
  114.  
  115. #endif __EGA_H
  116.